#include "stdafx.h"
#include "LevelManager.h"
#include "ObjectManager.h"

CLevelManager* CLevelManager::m_pInstance = NULL;

CLevelManager* CLevelManager::GetInstance()
{
	if(m_pInstance == NULL)
	{
		m_pInstance = new CLevelManager();
	}

	return m_pInstance;
}

void CLevelManager::Init()
{
	//Get an instance of the Object Manager
	this->m_pOBJManager = COBJManager::GetInstance();
}

void CLevelManager::LoadLevel()
{
	//Temporary Level creation
	//Variables we will need
	vec3f min, max; min.make_zero(); max.make_zero();
	//All are main outer walls
	int nType = MOBJ_BOX;

	//Box1
	AABB* box1 = new AABB();
	min.x = 20.0f; min.y = 0.0f; min.z = 20.0f;
	max.x = 30.0f; max.y = 4.0f; max.z = 30.0f;
	box1->Create(min, max, -1, nType);

	m_pOBJManager->m_vAABBs.push_back(box1);

	//Box 2
	AABB* box2 = new AABB();
	min.x = 20.0f; min.y = 8.0f; min.z = 40.0f;
	max.x = 35.0f; max.y = 10.0f; max.z = 80.0f;
	box2->Create(min, max, -1, nType);

	m_pOBJManager->m_vAABBs.push_back(box2);

	//Box 3
	AABB* box3 = new AABB();
	min.x = 25.0f; min.y = 4.0f; min.z = 25.0f;
	max.x = 28.0f; max.y = 6.0f; max.z = 28.0f;
	box3->Create(min, max, -1, nType);

	m_pOBJManager->m_vAABBs.push_back(box3);

	//Box 4
	AABB* box4 = new AABB();
	min.x = 40.0f; min.y = 0.0f; min.z = 15.0f;
	max.x = 60.0f; max.y = 6.0f; max.z = 60.0f;
	box4->Create(min, max, -1, nType);

	m_pOBJManager->m_vAABBs.push_back(box4);

	//Box 5
	AABB* box5 = new AABB();
	min.x = 40.0f; min.y = 6.0f; min.z = 40.0f;
	max.x = 50.0f; max.y = 10.0f; max.z = 60.0f;
	box5->Create(min, max, -1, nType);

	m_pOBJManager->m_vAABBs.push_back(box5);
}